let cartCount = 0;
document.querySelectorAll('.buy').forEach(button => {
    button.addEventListener('click', () => {
        cartCount++;
        document.querySelector('#cart span').textContent = cartCount;
        alert('已添加到购物车！');
    });
});